import service from "../libs/request";

/**
 * 获取验证码地址
 */
export function Captcha(data) {
    let timestamp = (new Date()).getTime();
    return service.request({
        url: "/admin/auth/core/captcha?t=" + timestamp,
        method: "get",
        params: data,
        responseType: 'arraybuffer'
    })
}

/**
 * 登录
 */
export function Login(data) {
    return service.request({
        url: "/admin/auth/core/login",
        method: "post",
        data: data
    })
}


/**
 * 注销登录
 * @param data
 * @returns {Promise<AxiosResponse<T>>}
 * @constructor
 */
export function Logout(data) {
    return service.request({
        url: "/admin/auth/core/logout",
        method: "post",
        data: data
    })
}


/**
 * 获取登录用户信息
 * @param data
 * @returns {Promise<AxiosResponse<T>>}
 * @constructor
 */
export function UserInfo(data) {
    return service.request({
        url: "/admin/auth/core/user",
        method: "post",
        data: data
    })
}

/**
 * 修改密码
 * @param data
 * @returns {Promise<AxiosResponse<T>>}
 * @constructor
 */
export function ResetPassword(data) {
    return service.request({
        url: "/admin/auth/core/reset",
        method: "post",
        data: data
    })
}

/**
 * 修改用户信息
 * @param data
 * @returns {Promise<AxiosResponse<T>>}
 * @constructor
 */
export function Info(data) {
    return service.request({
        url: "/admin/auth/core/info",
        method: "post",
        data: data
    })
}

/**
 * 菜单树
 * @param data
 */
export function menuList(data) {
    return service.request({
        url: "/admin/auth/menu/list",
        method: "get",
        params: data,
    })
}

// 以下为首页内容

// 概况
export function getOverview(data) {
    return service.request({
        url: "/admin/statistical/log/overview",
        method: "get",
        params: data,
    })
}

// 云图访问分布
export function yuntuVisit(data) {
    return service.request({
        url: "/admin/statistical/log/cloud-stat",
        method: "get",
        params: data,
    })
}

// 系统报警趋势
export function systemWarningLine(data) {
    return service.request({
        url: "/admin/statistical/log/warning",
        method: "get",
        params: data,
    })
}

// 系统报警列表

export function systemListData(data) {
    return service.request({
        url: "/admin/statistical/log/warning-list",
        method: "get",
        params: data,
    })
}

// 系统登录日志
export function loginList(data) {
    return service.request({
        url: "/admin/statistical/log/login",
        method: "get",
        params: data,
    })
}

// 云图访问日志
// export function loginList(data) {
//     return service.request({
//         url: "/admin/statistical/log/login",
//         method: "get",
//         params: data,
//     })
// }
// 后台操作日志
export function backstageList(data) {
    return service.request({
        url: "/admin/statistical/log/access",
        method: "get",
        params: data,
    })
}